
<script lang="ts">

import { computed, defineComponent, h, onMounted, renderSlot, watch } from "vue";
import { useSystemInfo } from "@/store/pinia-store";

export default defineComponent({
  props: {
    power: String
  },
  setup(props, { slots, expose }) {

    const systemInfo = useSystemInfo()
    // 如果是admin就不受权限控制
    const wasAdmin = computed(() => systemInfo.userInfo?.adminType === 1);
    // 默认不显示
    const hasPower = computed(() => {
      return systemInfo.PowerButtons.has(props.power);
    });
    return {
      wasAdmin,
      hasPower,
    }
  },
});
</script>
<template>
  <slot v-if="wasAdmin || hasPower" />

</template>
